#ifndef __MEMPOOL_H__
#define __MEMPOOL_H__

#include <malloc.h>

#define UNITSIZE 1024 * 1024 * 128
typedef struct block {
    void *data;
    struct block *next;
} block;
typedef struct MemPool {
    void *EndBlock;
    void *self1;
    struct block *AllocatedMemBlock;
    struct block *FreeMemBlock;
} MemPool;

struct block *mempool_allocblock(struct MemPool pool);

void InitPool();
void *acemesh_myalloc_aligned_4(int datasize);
void *acemesh_myalloc_aligned_8(int datasize);
void *acemesh_myalloc_aligned_16(int datasize);
void *acemesh_myalloc_aligned_32(int datasize);
void *acemesh_myalloc_aligned_64(int datasize);
void ReInitial();
void FreePool();

void slave_initpool();
void *slave_my_malloc_aligned(int size);
// void *my_malloc_aligned(int size);
void my_free_aligned(void *self);
void slave_my_free_aligned(void *self);
void *slave_acemesh_myalloc_aligned_64(int datasize, int _myid);
void *slave_acemesh_myalloc_aligned_16(int datasize, int myid);
void slave_InitPool(int _myid);
void slave_ReInitial(int _myid);
void slave_FreePool(int _myid);
struct block *slave_mempool_allocblock(struct MemPool slave_pool);
#endif
